//
//  HomePageCardView.m
//  DBAChain
//
//  Created by Evan on 2018/9/6.
//  Copyright © 2018 Evan. All rights reserved.
//

#import "HomePageCardView.h"
#import <Masonry.h>

@implementation HomePageCardView

-(instancetype)init{
    self = [super init];
    if (self) {
        [self initUI];
    }
    return self;
}

-(void)initUI{
    [self imgBg];
    [self imgViewLine];
    
    [self imgLeftCard];
    [self labelTitle];
    [self labelDsl];
    [self labelDslDes];
    [self labelYsl];
    [self labelYslDes];
    [self labelZsl];
    [self labelZslDes];
    
    [self labelZCount];
    [self labelSYCount];
}



-(UIImageView*)imgBg{
    if (!_imgBg) {
        _imgBg = [[UIImageView alloc]init];
        [self addSubview:_imgBg];
        [_imgBg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self).offset(20);
            make.right.mas_equalTo(self).offset(20);
            make.top.mas_equalTo(self).offset(20);
            make.height.offset(173);
        }];
        _imgBg.image = [UIImage imageNamed:@"圆角矩形 6"];
    }
    return _imgBg;
}

-(UIImageView*)imgViewLine{
    if (!_imgViewLine) {
        _imgViewLine = [[UIImageView alloc]init];
        [self.imgBg addSubview:_imgViewLine];
        [_imgViewLine mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.imgBg.mas_left).offset(8);
            make.right.mas_equalTo(self.imgBg.mas_right).offset(-8);
            make.top.mas_equalTo(self.imgBg).offset(125);
            make.height.offset(5);
        }];
        _imgViewLine.image = [UIImage imageNamed:@"分割线Card"];
    }
    return _imgViewLine;
}

///卡片左侧图标
-(UIImageView*)imgLeftCard{
    if (!_imgLeftCard) {
        _imgLeftCard = [[UIImageView alloc]init];
        [self.imgBg addSubview:_imgLeftCard];
        [_imgLeftCard mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.imgBg).offset(32);
            make.top.mas_equalTo(self.imgBg).offset(23);
            make.height.offset(93);
            make.width.offset(70);
        }];
        _imgLeftCard.image = [UIImage imageNamed:@"图标card"];
    }
    return _imgLeftCard;
}

///卡片标题
- (UILabel*)labelTitle{
    if (!_labelTitle) {
        _labelTitle = [[UILabel alloc]init];
        [self.imgBg addSubview:_labelTitle];
        [_labelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.imgLeftCard.mas_right).offset(20);
            make.top.mas_equalTo(self.imgBg).offset(28);
            make.height.offset(14);
            make.width.offset(100);
        }];
//        _labelTitle.text = @"A:智能算码";
        _labelTitle.font = [UIFont fontWithName:@"PingFang-SC-Bold" size:13];
        _labelTitle.textColor = [UIColor whiteColor];
    }
    return _labelTitle;
}

///当前计算能力
- (UILabel*)labelDsl{
    if (!_labelDsl) {
        _labelDsl = [[UILabel alloc]init];
        [self.imgBg addSubview:_labelDsl];
        [_labelDsl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.labelTitle.mas_left);
            make.top.mas_equalTo(self.labelTitle.mas_bottom).offset(10);
            make.height.offset(14);
            make.width.offset(100);
        }];
        _labelDsl.text = @"单位算力：";
        _labelDsl.font = [UIFont fontWithName:@"PingFang-SC-Light" size:12];
        _labelDsl.textColor = [UIColor whiteColor];
    }
    return _labelDsl;
}

///当前计算能力结果
- (UILabel*)labelDslDes{
    if (!_labelDslDes) {
        _labelDslDes = [[UILabel alloc]init];
        [self.imgBg addSubview:_labelDslDes];
        [_labelDslDes mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(self.imgBg.mas_right).offset(-30);
            make.top.mas_equalTo(self.labelTitle.mas_bottom).offset(10);
            make.height.offset(14);
            make.width.offset(100);
        }];
//        _labelDslDes.text = @"10/天";
        _labelDslDes.font = [UIFont fontWithName:@"PingFang-SC-Light" size:12];
        _labelDslDes.textColor = [UIColor whiteColor];
        _labelDslDes.textAlignment = NSTextAlignmentRight;
    }
    return _labelDslDes;
}


///已产生总量
- (UILabel*)labelYsl{
    if (!_labelYsl) {
        _labelYsl = [[UILabel alloc]init];
        [self.imgBg addSubview:_labelYsl];
        [_labelYsl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.labelDsl.mas_left);
            make.top.mas_equalTo(self.labelDsl.mas_bottom).offset(10);
            make.height.offset(14);
            make.width.offset(100);
        }];
        _labelYsl.text = @"已产生总量：";
        _labelYsl.font = [UIFont fontWithName:@"PingFang-SC-Light" size:12];
        _labelYsl.textColor = [UIColor whiteColor];
    }
    return _labelYsl;
}

///当前计算能力
- (UILabel*)labelYslDes{
    if (!_labelYslDes) {
        _labelYslDes = [[UILabel alloc]init];
        [self.imgBg addSubview:_labelYslDes];
        [_labelYslDes mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(self.labelDslDes.mas_right);
            make.top.mas_equalTo(self.labelDsl.mas_bottom).offset(10);
            make.height.offset(14);
            make.width.offset(100);
        }];
//        _labelYslDes.text = @"800万GET";
        _labelYslDes.font = [UIFont fontWithName:@"PingFang-SC-Light" size:12];
        _labelYslDes.textColor = [UIColor whiteColor];
        _labelYslDes.textAlignment = NSTextAlignmentRight;
    }
    return _labelYslDes;
}

///已产生总量
- (UILabel*)labelZsl{
    if (!_labelZsl) {
        _labelZsl = [[UILabel alloc]init];
        [self.imgBg addSubview:_labelZsl];
        [_labelZsl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.labelDsl.mas_left);
            make.top.mas_equalTo(self.labelYsl.mas_bottom).offset(10);
            make.height.offset(14);
            make.width.offset(100);
        }];
        _labelZsl.text = @"总产量：";
        _labelZsl.font = [UIFont fontWithName:@"PingFang-SC-Light" size:12];
        _labelZsl.textColor = [UIColor whiteColor];
    }
    return _labelYsl;
}

///当前计算能力
- (UILabel*)labelZslDes{
    if (!_labelZslDes) {
        _labelZslDes = [[UILabel alloc]init];
        [self.imgBg addSubview:_labelZslDes];
        [_labelZslDes mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(self.labelDslDes.mas_right);
            make.top.mas_equalTo(self.labelYsl.mas_bottom).offset(10);
            make.height.offset(14);
            make.width.offset(100);
        }];
//        _labelZslDes.text = @"1800万GET";
        _labelZslDes.font = [UIFont fontWithName:@"PingFang-SC-Light" size:12];
        _labelZslDes.textColor = [UIColor whiteColor];
        _labelZslDes.textAlignment = NSTextAlignmentRight;
    }
    return _labelZslDes;
}

///算码总量
- (UILabel*)labelZCount{
    if (!_labelZCount) {
        _labelZCount = [[UILabel alloc]init];
        [self.imgBg addSubview:_labelZCount];
        [_labelZCount mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.imgLeftCard.mas_left).offset(5);
            make.top.mas_equalTo(self.imgViewLine.mas_bottom).offset(5);
            make.height.offset(14);
            make.width.offset(200);
        }];
//        _labelZCount.text = @"算码总量：3000枚";
        _labelZCount.font = [UIFont systemFontOfSize:12];
        _labelZCount.textColor = [UIColor whiteColor];
    }
    return _labelZCount;
}

///剩余算码总量
- (UILabel*)labelSYCount{
    if (!_labelSYCount) {
        _labelSYCount = [[UILabel alloc]init];
        [self.imgBg addSubview:_labelSYCount];
        [_labelSYCount mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(self.labelZslDes.mas_right);
            make.top.mas_equalTo(self.labelZCount);
            make.height.mas_equalTo(self.labelZCount);
            make.width.mas_equalTo(self.labelZCount);
        }];
//        _labelSYCount.text = @"剩余：2900枚";
        _labelSYCount.font = [UIFont systemFontOfSize:12];
        _labelSYCount.textColor = [UIColor whiteColor];
        _labelSYCount.textAlignment = NSTextAlignmentRight;
    }
    return _labelSYCount;
}


@end
